import java.util.Scanner;
public class Temperatures
{
   public static void main (String[] args)
   {
      // Define constants

      double convertedTemp;

      // Display prompt for temperature in degrees Farhenheit or Celsius
      System.out.print("Please enter the temperature in degrees: \n");

      // Read temperature
      Scanner in = new Scanner(System.in);
      double temp = in.nextDouble();

      // Display prompt for character that denotes type of temperature
      System.out.print("Enter F for Farhenheit or C for Celsius: \n");

      // Read character denoting type of temperature
      String type = in.next();

      // Compute and print Celsius or Farhenheit equivalent
      if(type.compareTo("F")==0) {
         System.out.print("Celsius: ");
         convertedTemp = (temp - 32.0) * 5 / 9;
      }
      else {
         System.out.print("Farhenheit: ");
         convertedTemp = temp * 9 / 5 + 32.0;
      }
      
      System.out.println(convertedTemp);
   }
}